#ifndef CPIR_NALGO_H
#define CPIR_NALGO_H

#include "common.h"
#include <ctime>
#include <windows.h>

//   Copyright 2011 CPIR Team
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.


int32_t mulinv(int32_t e, int32_t n);                                      // calculate mulinv(e,n) : ( e*mulinv(e,n) ) mod n = 1
int32_t mod(int32_t e, int32_t x, int32_t n);                              // calculate mod(e,x,n) = e^x (mod n)
bool isPrime( int32_t n );                                                 // judge n is a prime number or not
cmsg_t rabinOTClientEncode(msg_t x, key_t k, key_t n, key_t e);            // 1-2 OT Step 5, v = (x_b + k^e) mod N
cmsg_t rabinOTServerEncode(cmsg_t v, msg_t m, msg_t x, key_t d, key_t n);  // 1-2 OT Step 6 & Step 7
msg_t rabinOTDecode(cmsg_t mc, key_t k);                                   // 1-2 OT Step 8

#endif
